<?php
include_once 'xml/Serializer.php';
include_once 'xml/Unserializer.php';

abstract class ManipuladorXML {
	static function serializar($objeto) {
		$opcoes = array(
					XML_SERIALIZER_OPTION_XML_DECL_ENABLED => true,
					XML_SERIALIZER_OPTION_INDENT => '    ',
					XML_SERIALIZER_OPTION_RETURN_RESULT => true,
					XML_SERIALIZER_OPTION_TYPEHINTS => TRUE);
		
		$serializer = new XML_Serializer();
		return $serializer->serialize($objeto, $opcoes);
	}
	
	static function desserializar($xml) {
		$opcoes = array(XML_UNSERIALIZER_OPTION_RETURN_RESULT => true);
		
		$unserializer = new XML_Unserializer();
		return $unserializer->unserialize($xml, false, $opcoes);
	}
}
?>